package 二叉树.m03.d13.t05;

import 二叉树.m03.TreeNode;

class Solution {
    public TreeNode flipTree(TreeNode root) {
        flip(root);
        return root;
    }
    void flip(TreeNode node) {
        if(node == null) {
            return;
        }
        TreeNode l = node.left;
        TreeNode r = node.right;
        node.left = r;
        node.right = l;
        flip(l);
        flip(r);
    }
}